<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<html>
<head>
<title>khutro.net</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="css/userpage.css" rel="stylesheet" type="text/css">
<link href="css/button.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
em {
	color: #999;
}

#contentmain .container2 .logincontent .logincontentmain h3 {
	color: #040406;
}
-->
</style>
<style type="text/css">
.ac_over {
	color: white; background-color:green;
}
</style>
<link href="css/custom-theme/jquery-ui-1.9.0.custom.css"
	rel="stylesheet">
<script src="js/jquery-1.8.2.js"></script>
<SCRIPT type="text/javascript" src="js/items.js"></SCRIPT>
<script src="js/scroll-startstop.events.jquery.js"
	type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/jquery-ui-1.9.0.custom.js"></script>
<script type="text/javascript" src="js/jsondata.js"></script>
<script src="js/gen_validatorv4.js" type="text/javascript"></script>
<script type="text/javascript">
	function getcurrenturlvalue(){
		var url = "getCurrentUrl.action";
		var testurl = $('#testurl').val();
		var toRemove = 'http://localhost:8080/FSH_Final/';
		var curUrl = testurl.replace(toRemove,'');
		$.ajax({
			url : url,
			data : {
				curUrl : curUrl 
				
			},
			success : function(data) {
				window.location = "login.jsp";
				
			}
		});
	}
</script>
<script>
	$(function() {

		$("#accordion").accordion();

		var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC",
				"C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang",
				"Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp",
				"Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ];
		$("#autocomplete").autocomplete({
			source : availableTags
		});

		$("#button").button();
		$("#radioset").buttonset();

		$("#tabs").tabs();

		$("#dialog").dialog({
			autoOpen : false,
			width : 400,
			buttons : [ {
				text : "Ok",
				click : function() {
					$(this).dialog("close");
				}
			}, {
				text : "Cancel",
				click : function() {
					$(this).dialog("close");
				}
			} ]
		});

		// Link to open the dialog
		$("#dialog-link").click(function(event) {
			$("#dialog").dialog("open");
			event.preventDefault();
		});

		$("#datepicker").datepicker({
			inline : true
		});

		$("#slider").slider({
			range : true,
			values : [ 17, 67 ]
		});

		$("#progressbar").progressbar({
			value : 20
		});

		// Hover states on the static widgets
		$("#dialog-link, #icons li").hover(function() {
			$(this).addClass("ui-state-hover");
		}, function() {
			$(this).removeClass("ui-state-hover");
		});
		// add multiple select / deselect functionality
		$("#selectall").click(function() {
			$('.case').attr('checked', this.checked);
		});

		// if all checkbox are selected, check the selectall checkbox
		// and viceversa
		$(".case").click(function() {

			if ($(".case").length == $(".case:checked").length) {
				$("#selectall").attr("checked", "checked");
			} else {
				$("#selectall").removeAttr("checked");
			}

		});
	});
</script>
<style>
.demoHeaders {
	margin-top: 2em;
}

#dialog-link {
	padding: .4em 1em .4em 20px;
	text-decoration: none;
	position: relative;
}

#dialog-link span.ui-icon {
	margin: 0 5px 0 0;
	position: absolute;
	left: .2em;
	top: 50%;
	margin-top: -8px;
}

#icons {
	margin: 0;
	padding: 0;
}

#icons li {
	margin: 2px;
	position: relative;
	padding: 4px 0;
	cursor: pointer;
	float: left;
	list-style: none;
}

#icons span.ui-icon {
	float: left;
	margin: 0 4px;
}
</style>
<link href="css/info.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/stylesconfirm.css">
<script type="text/javascript" src="script/jquery.reveal.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function() {
		jQuery('#buttonconfirm').click(function(e) { // Button which will activate our modal
			jQuery('#modal').reveal({ // The item which will be opened with reveal
				animation : 'fade', // fade, fadeAndPop, none
				animationspeed : 300, // how fast animtions are
				closeonbackgroundclick : true, // if you click background will modal close?
				dismissmodalclass : 'close' // the class of a button or element that will close an open modal
			});
			return false;
		});
	});
</script>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0"
	marginheight="0">
	<!-- Save for Web Slices (khutroslide.psd) -->
	<div id="header">
		<div id="headerContent">
			<a href="index.action" id="logo">khutro</a>
			<ul id="menuBar">
				<li><a href="index.action">Trang chủ</a></li>
				<li><a href="help.jsp">Trợ giúp</a></li>
				<li><a href="checkaddtopic.action">Đăng cho thuê</a>
				<li><a href="checkaddsharetopic.action">Đăng chia sẻ</a>
				<li><a href="compareresult.action">So sánh<span
						id="numberCompare" style="color: red; font-size: 12px">(${number})</span>
				</a></li>
				
			</ul>
			<div id="modal5">
				<div id="heading5">Thông báo !</div>
				<div id="content5">
					<p style="text-align: left; padding-left: 10px; color: black;">Bạn
						cần đăng nhập để sử dụng chức năng này</p>
					<p style="text-align: left; padding-left: 10px; color: black;">Đăng
						nhập với tài khoản của Facebook</p>
						<br/>
					<a style="text-align: left;" href="login.jsp"
						class="button1 green close"><img src="images/dialog/tick.png">Đăng
						nhập</a> <a style="text-align: left;" href="javascript:void(0);"
						class="button1 red close"><img src="images/dialog/cross.png">Đóng</a>
				</div>
			</div>
			<div id="loginPanel">
				<c:choose>
					<c:when test="${displayNamess!=null}">
						<a class="profileButton" href="profileuser.action">${displayNamess}
						</a>
						<ul>
							<c:choose>
								<c:when test="${userRoleIdss==1}">
									<li><a href="adminloadsystem.action">Trang quản lý</a>
								</c:when>
							</c:choose>
							<li><a href="profileuser.action">Trang cá nhân</a></li><li><a href="changepass.jsp">Đổi mật khẩu</a>
							</li>
							<li><a href="logout.jsp">Thoát</a>
							</li>
						</ul>
					</c:when>
					<c:otherwise>
						<a class="loginButton" href="javascript:void(0);" onclick="getcurrenturlvalue();">Đăng nhập</a>
					</c:otherwise>
				</c:choose>
			</div>
			<div id="search">
			<DIV class="search-box">
			  <div style="width: 80%;float: left">
		      <INPUT id="lookup_input" class="search-bar" style="width: 220px;height: 24px;" name="keysearch" value="Tìm Kiếm ..." type="text">
		      </div>
		      <div style="width: 19%;float: right;">
		      <img alt="search" src="images/search.png" width="24" height="24" onclick="searchFull();">
		      </div>
				<SCRIPT type="text/javascript" src="js/searchfulltext.js"></SCRIPT>
		      
		      <FORM id="search-form" method="post" action="fulltextsearch.action">
		      	<INPUT id="sortby" class="search-bar" name="sortby" value="0" type="hidden">
		      </FORM>
      		</DIV>
			</div>  
		</div>
	</div>
	<script type="text/javascript">
	$('#lookup_input').bind('keypress', function(e) {
		if(e.keyCode==13){
			searchFull();
		}
	});
	</script>
	<img src="images/spacer.gif" width="1" height="56" alt="">

	<div id="contentmain">
		<div class="containeruserpage1">
			<div id="tabs">
				<ul>
					<li><a href="#tabs-1">Thông tin tài khoản</a>
					</li>
					<li><a href="#tabs-2">Bài yêu thích</a>
					</li>
					<li><a href="#tabs-3">Bài đã tạo</a>
					</li>
				</ul>
				<div style="min-height: 790px;" id="tabs-1">
					<div class="headeruser">
						<span style="margin: 20px 0 0px 15px;">Tài khoản</span>
					</div>
					<table width="100%" border="0" cellpadding="0" cellspacing="0"
						class="usercontent">
						<tr>
							<td width="35%">
								<div class="avatarimg">
									<img src="${users[0][4]}" width="128" height="128"><br>
									<a href="javascript:void(0);" id="buttonconfirm" style="color: #00F">Xóa ảnh
										đại diện</a>

									<div id="modal">
										<div id="heading1">Bạn có chắc chắn muốn xóa ảnh đại
											diện ?</div>
										<div id="content1">
											<a style="text-align: left;" href="deleteavatar.action"
												class="button1 green close"><img
												src="images/dialog/tick.png">Đồng ý</a> <a
												style="text-align: left;" href="javascript:void(0);" class="button1 red close"><img
												src="images/dialog/cross.png">Bỏ qua</a>
										</div>
									</div>
								</div>
							</td>
							<td width="65%">
								<div class="basicinfo">
									<form action="updateProfile" method="post"
										enctype="multipart/form-data" id="updateProfile">
										<table>

											<tr>
												<td style="font-size: 14px; color: #034B8A;">Email:</td>
												<td style="font-size: 14px; color: black;"><s:property
														value="email" />
												</td>
											</tr>
											<tr>
												<td style="font-size: 14px; color: #034B8A;">Tên hiển
													thị:</td>
												<td style="font-size: 14px; color: black;"><input
													type="text" name="username" id="userNameDisplay"
													value="${users[0][1]}" maxlength="50" /></td>
											</tr>
											<tr>

												<s:file name="userImage" id="userImage" size="23px"
													label="Ảnh đại diện" />

											</tr>

											<s:submit value="Lưu lại" align="center" />

										</table>
									</form>
								</div>
							</td>
						</tr>
					</table>
					<script type="text/javascript">
						
							$("#userNameDisplay").attr("maxlength", 50);
							</script>
					<div class="headeruser">
						<span style="margin: 3px 0 3px 15px;">Thống kê</span>
					</div>
					<table border="0" cellpadding="0" cellspacing="0" class="tkmain">
						<tr>
							<td>
								<div class="thongke" style="width: 30%">
									Tham gia từ:<br> <br> Đăng nhập cuối:<br> <br>
									Số bài đăng:<br> <br>

								</div>
							</td>
							<td>
								<div class="thongke" style="width: 70%">
									<span style="color: black;"><s:property
											value="users[0][2]" /> </span><br> <br> <span
										style="color: black;"><s:property value="users[0][3]" />
									</span><br> <br> <span style="color: black;"><s:property
											value="topics[0]" /> </span><br> <br>
								</div>
							</td>
						</tr>
					</table>
				</div>
				<div style="min-height: 790px;" id="tabs-2">
					<div style="width: 100%">
						<a href="javascript:void(0);" class="delete" id="btnClick">Xoá</a>
					</div>
					<br>
					<div class="headertable">
						<input type="checkbox" name="localtion" value="-1" id="selectall">
						<span style="margin-left: 30px">Ảnh</span> <span
							style="margin-left: 102px">Bài đăng</span>
					</div>
					<div id="favtopic">
						<s:iterator value="ownerFavorite" status="status" id="testlist">
							<div class="contentinfo">
								<div class="checkbox">
									<input type="checkbox" class="case" name="localtion"
										value="<s:property
											value="ownerFavorite[#status.index][9]" />">
								</div>
								<div class="smallimg">
									<div class="smallimgview">
										<img
											src="Img/Topic/<s:property value="ownerFavorite[#status.index][8]" />"
											width="88" height="58" alt="">
									</div>
								</div>
								<div class="contentinfomain">
									<div class="title_content">
										<a
											href="detail.action?topicId=<s:property
											value="ownerFavorite[#status.index][9]" />&districtId=<s:property
											value="ownerFavorite[#status.index][11]" />"
											class="atitle" style="color: #034B8A;"><s:property
												value="ownerFavorite[#status.index][0]" /> </a>
									</div>
									<div class="address_content">
										<s:property value="ownerFavorite[#status.index][1]" />
									</div>
									<div class="address_content">
										<div class="splitcontent1">
											Giá:<span style="color: #FF4500"><s:property
													value="ownerFavorite[#status.index][2]" /> triệu/tháng</span>
										</div>
										<div class="splitcontent1">
											Diện tích: <span style="color: #FF4500"><s:property
													value="ownerFavorite[#status.index][3]" /> m2</span>
										</div>
										<div class="splitcontent1">
											Lượt xem: <span style="color: #1E90FF"><s:property
													value="ownerFavorite[#status.index][4]" /> </span>
										</div>
									</div>
									<div class="address_content">

										<div class="splitcontent1" style="width: 60%">
											Ngày tạo: <span style="color: #1E90FF"><s:property
													value="ownerFavorite[#status.index][5]" /> </span>
										</div>
										<div class="splitcontent1">
											<s:if test="ownerFavorite[#status.index][13].length()>10">
											Tạo bởi: <span style="color: #1E90FF"><s:property
														value="ownerFavorite[#status.index][13].substring(0,10)" />
												</span>
											</s:if>
											<s:else>
											Tạo bởi: <span style="color: #1E90FF"><s:property
														value="ownerFavorite[#status.index][13]" /> </span>
											</s:else>
										</div>
									</div>
								</div>
								<s:if test="ownerFavorite[#status.index][11]==2">
									<div class="boxleftcontent" id="price_content"
										style="background: #F0F8FF">
										<div class="splitrightc1">
											<a style="color: #00C"><s:property
													value="ownerFavorite[#status.index][14]" /> </a>
										</div>
										<s:if test="ownerFavorite[#status.index][15]==1">
											<div class="splitrightc1" style="color: Blue">Hiện</div>
										</s:if>
										<s:if test="ownerFavorite[#status.index][15]==2">
											<div class="splitrightc1" style="color: green;">Bị Ẩn</div>
										</s:if>
										<div class="splitrightc1">
											<a style="color: #32CD32">Chia sẻ</a>
										</div>

									</div>
								</s:if>
								<s:if test="ownerFavorite[#status.index][11]==1">
									<div class="boxleftcontent" id="price_content"
										style="background: #F0F8FF">
										<div class="splitrightc1">
											<a style="color: #00C"><s:property
													value="ownerFavorite[#status.index][14]" /> </a>
										</div>
										<s:if test="ownerFavorite[#status.index][15]==1">
											<div class="splitrightc1" style="color: Blue">Hiện</div>
										</s:if>
										<s:if test="ownerFavorite[#status.index][15]==2">
											<div class="splitrightc1" style="color: green;">Bị Ẩn</div>
										</s:if>
										<div class="splitrightc1">
											<a style="color: #FF0000">Cho thuê</a>
										</div>

									</div>
								</s:if>

							</div>
						</s:iterator>
					</div>
				</div>
				<div style="min-height: 790px;" id="tabs-3">
					<h4
						style="text-align: center; font: 12px Arial, Geneva, sans-serif; color: red;">Lưu
						ý : Hãy vào chi tiết từng bài để thực hiện các chức năng chỉnh sửa
						!</h4>
					<br>

					<div class="headertable">
						<span style="margin-left: 10px">Ảnh</span> <span
							style="margin-left: 80px">Bài đăng</span>
					</div>
					<s:iterator value="ownerTopics" status="status">
						<div class="contentinfo">

							<div class="smallimg">
								<div class="smallimgview">
									<img
										src="Img/Topic/<s:property value="ownerTopics[#status.index][8]" />"
										width="88" height="58" alt="">
								</div>
							</div>
							<div class="contentinfomain">
								<div class="title_content">
									<a
										href="detail.action?topicId=<s:property
											value="ownerTopics[#status.index][9]" />&districtId=<s:property
											value="ownerTopics[#status.index][11]" />"
										class="atitle" style="color: #034B8A;"><s:property
											value="ownerTopics[#status.index][0]" /> </a>
								</div>
								<div class="address_content">
									<s:property value="ownerTopics[#status.index][1]" />
								</div>
								<div class="address_content">
									<div class="splitcontent1">
										Giá:<span style="color: #FF4500"><s:property
												value="ownerTopics[#status.index][2]" /> triệu/tháng</span>
									</div>
									<div class="splitcontent1">
										Diện tích: <span style="color: #FF4500"><s:property
												value="ownerTopics[#status.index][3]" /> m2</span>
									</div>
									<div class="splitcontent1">
										Lượt xem: <span style="color: #1E90FF"><s:property
												value="ownerTopics[#status.index][4]" /> </span>
									</div>
								</div>
								<div class="address_content">

									<div class="splitcontent1" style="width: 60%">
										Ngày tạo: <span style="color: #1E90FF"><s:property
												value="ownerTopics[#status.index][5]" /> </span>
									</div>
									<div class="splitcontent1">
										<s:if test="ownerTopics[#status.index][13].length()>10">
										Tạo bởi: <span style="color: #1E90FF"><s:property
													value="ownerTopics[#status.index][13].substring(0,10)" /> </span>
										</s:if>
										<s:else>
										Tạo bởi: <span style="color: #1E90FF"><s:property
													value="ownerTopics[#status.index][13]" /> </span>
										</s:else>
									</div>
								</div>
							</div>
							<s:if test="ownerTopics[#status.index][11]==2">
								<div class="boxleftcontent" id="price_content"
									style="background: #F0F8FF">
									<div class="splitrightc1">
										<a style="color: #00C"><s:property
												value="ownerTopics[#status.index][14]" /> </a>
									</div>
									<s:if test="ownerTopics[#status.index][15]==1">
										<div class="splitrightc1" style="color: Blue">Hiện</div>
									</s:if>
									<s:if test="ownerTopics[#status.index][15]==2">
										<div class="splitrightc1" style="color: green;">Bị Ẩn</div>
									</s:if>
									<div class="splitrightc1">
										<a style="color: #32CD32">Chia sẻ</a>
									</div>

								</div>
							</s:if>
							<s:if test="ownerTopics[#status.index][11]==1">
								<div class="boxleftcontent" id="price_content"
									style="background: #F0F8FF">
									<div class="splitrightc1">
										<a style="color: #00C"><s:property
												value="ownerTopics[#status.index][14]" /> </a>
									</div>
									<s:if test="ownerTopics[#status.index][15]==1">
										<div class="splitrightc1" style="color: Blue">Hiện</div>
									</s:if>
									<s:if test="ownerTopics[#status.index][15]==2">
										<div class="splitrightc1" style="color: green;">Bị Ẩn</div>
									</s:if>
									<div class="splitrightc1">
										<a style="color: #FF0000">Cho thuê</a>
									</div>

								</div>
							</s:if>

						</div>
					</s:iterator>
				</div>
			</div>
		</div>
	</div>
	<div id="footercus" style="text-align: center; font-size: 12px">
		Designed by FU team | Powered by Struts<br> khutro.net
	</div>
	<div style="display: none;" class="nav_up" id="nav_up"></div>
	<div style="display: none;" class="nav_down" id="nav_down"></div>
	<script>
		jQuery(function() {
			var $elem = $('#contentmain');

			jQuery('#nav_up').fadeIn('slow');
			jQuery('#nav_down').fadeIn('slow');

			jQuery(window).bind('scrollstart', function() {
				$('#nav_up,#nav_down').stop().animate({
					'opacity' : '0.2'
				});
			});
			jQuery(window).bind('scrollstop', function() {
				$('#nav_up,#nav_down').stop().animate({
					'opacity' : '1'
				});
			});

			jQuery('#nav_down').click(function(e) {
				$('html, body').animate({
					scrollTop : $elem.height()
				}, 800);
			});
			jQuery('#nav_up').click(function(e) {
				$('html, body').animate({
					scrollTop : '0px'
				}, 800);
			});
		});
	</script>
	<script language="JavaScript" type="text/javascript"
		xml:space="preserve">
		//         
		var frmvalidator = new Validator("updateProfile");

		frmvalidator.addValidation("userNameDisplay", "req",
				"Tên hiển thị không được trống");
		frmvalidator.addValidation("userNameDisplay", "maxlen=50",
		"Tên hiển thị quá dài");
		frmvalidator.addValidation("userImage", "file_extn=jpg;jpeg;png",
				"+ File ảnh chỉ chấp nhận : jpg,jpeg,png");
	</script>
	<!-- End Save for Web Slices -->
</body>
</html>